home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / a4invoic.zip / INV.TXT
Text File  |  1992-05-11  |  13KB  |  249 lines

  1.                Invoicing using Alpha FOUR Sets         05/11/92
  2.                -------------------------------
  3.  
  4. A basic guide to setting up an invoicing system using Sets in Alpha
  5. FOUR.
  6.  
  7. Many users purchase Alpha FOUR to use as an invoicing system. A
  8. database is a logical choice for this task. Some invoicing systems
  9. are simple enough so that a single (flat file) database setup will
  10. work just fine. A basic single database invoicing system would
  11. include fields such as INVOICE_NO, COMPANY, ADDRESS, LINE_ITEM1,
  12. DESC1, PRICE1, LINE_ITEM2, DESC2, PRICE2,etc... This simple example
  13. would allow for easy data entry and will be fine for the simplest of
  14. invoicing systems, however, as your needs grow you may want to take
  15. advantage of Alpha FOUR's powerful relational capability and create
  16. an invoicing system using a Set. 
  17.  
  18. There are two basic ways to set up an invoicing system in Alpha FOUR
  19. using Sets and what follows are examples of these two alternatives.
  20. The first section under each option contains a short description with
  21. the advantages and disadvantages. The second section goes into more
  22. detail about how to create the basic setup for each option. This
  23. write-up is only a start. You will no doubt want to customize your
  24. invoicing system to meet your own needs. At the end of this write-up
  25. are some suggestions for enhancing your invoicing system. 
  26.  
  27. Option 1
  28. --------
  29. An invoicing system with multiple line item records for each invoice.
  30.  
  31. Option 1 involves linking a main INVOICE database (one-to-many or
  32. "All") to a child LINE_ITEM database. This option will have a
  33. separate LINE_ITEM record for each line item. The two databases are
  34. linked with the INVOICE_NO field as the linking field.
  35.  
  36. Advantages: 
  37. Saves disk space; it takes up only as much disk space as you need for
  38. each new line item and you are not storing empty LINE_ITEM fields.
  39. Allows you to input an unlimited number of line items for each
  40. invoice. This is because line items are represented by separate child
  41. records and line items (records) are added to the LINE_ITEM database
  42. only as they are needed.
  43. When Searching, Option 1 also has the advantage because there's only
  44. 1 Item number field (1 PRICE field and 1 description field, etc) for
  45. all line items.
  46. This method makes it much easier to determine the number of each
  47. product sold for all invoices. Since the LINE_ITEM database contains
  48. only one item per record you can simply print a report from the
  49. LINE_ITEM database indexed and subgrouped on DESCRIPTION or ITEM_NO.
  50. The primary method for applying the line items against an inventory
  51. database is to use the Post utility. This method makes this posting
  52. operation much simpler because there is only one field that will
  53. contain the line items.  
  54.  
  55. Disadvantages: 
  56. You will not be able to view multiple line items from one invoice on
  57. a Form at the same time (you can however print a Report that will
  58. look like a traditional invoice form).
  59. You will not be able to see the total of all line items on a Form
  60. (although you will be able to total the line items for an invoice on
  61. a Report).
  62. More difficult to apply payments against multiple line item records
  63. and store the resulting balance in the database, however you can show
  64. the balance on a Report.
  65.  
  66.  
  67. 1. The first step is to create an INVOICE database with a common
  68. field such as INVOICE_NO (this field will be used to link this
  69. database to the LINE_ITEM database). You can also include other
  70. fields like NAME, ADDRESS, BILL_INFO and SHIP_INFO.
  71.  
  72. 2. Next create a separate database for line items (LINE_ITEM). The
  73. only field that must be included in both this database and the parent
  74. database is the common field (e.g. INVOICE_NO). This field will be
  75. used to link the two databases into a Set. Other fields you will want
  76. to include are ITEM_NO, DESCRIPTION, QUANTITY and PRICE. For this
  77. application there's no need to have PART1, PART2, etc because each
  78. record in this LINE_ITEM database will represent one line item.
  79.  
  80. 3. The next step is to link these databases together in a Set. Create
  81. an index in the child database (LINE_ITEM) on the common field
  82. (INVOICE_NO). Then link the two databases together into a Set with
  83. the INVOICE database as the parent and LINE_ITEM as the child. Use
  84. the INVOICE_NO index you just created in the child database as the
  85. Linking Index, and set "Link to ?" to ALL.
  86.  
  87. 4. To make data entry easier, create a custom Form under layouts that
  88. includes both INVOICE information and LINE_ITEM information. During
  89. data entry you will enter the INVOICE information right on that Form
  90. and you can "Zoom" to the child (LINE_ITEM) database to enter each
  91. line item. Remember that each line item is entered in a separate
  92. record in the LINE_ITEM database.
  93.  
  94. 5. You may want to create a Report to print these Invoices. The
  95. Report should have one level of subgrouping (see the Reference manual
  96. for information on subgrouping reports). On the Report's grouping
  97. Parameters screen, the group 1 break field would be the INVOICE_NO
  98. field. Place the fields from the INVOICE database into the group 1
  99. header. Place the line item fields from the LINE_ITEM database into
  100. the detail section. The group 1 footer is for any totals that you
  101. need for each invoice number. For example you may want to create a
  102. calculated field using the expression PRICE*QUANTITY and place this
  103. in the group 1 footer section as a total to get a subtotal for that
  104. invoice. 
  105.  
  106. Option 2
  107. --------
  108.  
  109. An invoicing system with multiple line item fields for each invoice.
  110. Option 2 involves linking the main INVOICE database (one-to-one or
  111. "First") to the child LINE_ITEM database. The main difference is that
  112. the LINE_ITEM database in this second option contains fields
  113. representing multiple line items (rather than a separate record for
  114. each line item). You will be only linking to one record in the
  115. LINE_ITEM database and this one record will contain all the line
  116. items for a given invoice.
  117.  
  118. Advantages: 
  119. This method allows you to view all line items for an invoice on a
  120. Form at one time.
  121. You can also display the line item total on a view Form.
  122. You can apply payments against the invoice total on the view Form. To
  123. do this, add multiple payment fields to the INVOICE database and a
  124. calculated BALANCE field: (TOTAL-PMT1+PMT2+PMT3).
  125.  
  126. Disadvantages:
  127. This method may be more cumbersome to work with when searching (i.e.
  128. an item may appear in any one of multiple LINE_ITEM fields).
  129. The number of possible line items attached to a given invoice are
  130. limited by the number of fields you have pre-defined; if your line
  131. items exceed the pre-set number of fields, you will need to place the
  132. additional line items on another invoice.
  133. This method makes it more difficult to determine the number of each
  134. product sold for all invoices because the same product may not appear
  135. in the same product field in each record.
  136.  
  137. This second type of invoice system using Sets in Alpha FOUR is the
  138. most popular and involves creating a LINE_ITEM database with multiple
  139. line items in one record (i.e. fields called ITEM1, ITEM2, ITEM3,
  140. PRICE1, PRICE2, PRICE3). Link the two databases together using a
  141. linking index on INVOICE_NO as described above. In this scenario,
  142. however, there will be only one LINE_ITEM record for each invoice.
  143. That one record will contain all line items for that invoice.
  144.  
  145. These are not the only ways to create Invoicing systems with Alpha
  146. FOUR, they are only suggestions. Please feel free to modify these to
  147. meet your specific needs.
  148.  
  149.  
  150. Enhancement Suggestions
  151.  
  152. Both Set options require you to zoom to the child database to enter
  153. the line items. Because this requires additional keystrokes, this can
  154. be seen as a disadvantage over a single database invoicing system.
  155. Using lookups, applications, scripts and the post utility can make
  156. zooming more efficient as you can see in the following examples.
  157.  
  158. Lookups; copying INVOICE_NO from parent to child:
  159. Data entry can be made easier by creating a lookup in the child
  160. database that pulls the invoice number from the last entered record
  161. in the parent database. First create a index on the INVOICE_NO field
  162. in the parent database. Then create a second index in the parent
  163. database using the expression: INVERT(RECNO( )). In the child
  164. (LINE_ITEM) database, go to the field rules and create a lookup on
  165. the INVOICE_NO field. Set Auto Pop-up to "YES". Specify the parent
  166. database (INVOICE) as the lookup database. The linking index will be
  167. the one you created on the INVOICE_NO field in the parent database.
  168. The display index will be the one you created using the expression
  169. INVERT(RECNO( )). On the lookup mapping screen, specify the
  170. INVOICE_NO as the only choice and filled field. 
  171.  
  172. During data entry, when you "Zoom" to the LINE_ITEM database to enter
  173. each line item this lookup will automatically pop-up with the last
  174. entered invoice number at the top of the lookup window. Selecting the
  175. top choice will fill in the INVOICE_NO field so the user doesn't have
  176. to remember it.
  177.  
  178. Lookups; linking an INVENTORY database to the LINE_ITEM database:
  179. If you add a database containing all the items you sell (INVENTORY),
  180. you can then attach this as a lookup to the LINE_ITEM database using
  181. a linking index based on the PART_NO field. Choose the DESC and PRICE
  182. fields as filled fields. If you are using option 2 above simply link
  183. the lookup to PART1, PART2, etc. This will make data entry quicker
  184. and more accurate. You should only need to type in the part number
  185. and quantity and the program should fill in the description and
  186. price.
  187.  
  188. Using a script to make zooming easier & more efficient (Alpha FOUR
  189. version 2 only):
  190. The scripting feature in Alpha FOUR version 2 allows you to set the
  191. zoom trigger (%SYS_TRIG_ZOOM) to automatically store the INVOICE_NO
  192. value into a variable (%INVNO) and automatically place this into all
  193. new records in the child. 
  194.  
  195. First create a script that will set %SYS_TRIG_ZOOM to the name of the
  196. script to play when a person zooms (COPYFLD). The contents of this
  197. script are as follows:
  198. {SET %SYS_TRIG_ZOOM, "COPYFLD"}
  199.  
  200. Then create a script called COPYFLD that copies the value in the
  201. INVOICE_NO field in the INVOICE database into the variable %INVNO,
  202. then zooms and enters this value into the INVOICE_NO field (in this
  203. case this is the first field on the child form):
  204. {SET %INVNO, INVOICE_NO}{TRIGKEYS {e{%INVNO}{ENTER}}}
  205. For more on scripts and triggers see the Alpha FOUR version 2
  206. reference manual.
  207. Using another child database for customers:
  208. If your company is like most, you will have more than one invoice for
  209. the same customer. To economize you may want to add a CUSTOMER child
  210. database to store customer information. Link this to the INVOICE
  211. database based on CUST_ID or the customer name. This is beneficial in
  212. two ways: 
  213. You only enter the customer information once (saves time and disk
  214. space).
  215. Address changes can be done once in the CUSTOMER database. Because
  216. the INVOICE database gets it's customer information from the CUSTOMER
  217. database, all invoices for that customer will now reflect the new
  218. address for that customer. 
  219.  
  220.  
  221. Applying items sold against an "in stock", inventory database:
  222. If you have an INVENTORY database containing all items you sell and
  223. the current quantities in stock (IN_STOCK), you can apply the items
  224. sold each day against this INVENTORY database using the Post utility.
  225. Simply create an index in the INVENTORY database on PART_NO, use the
  226. Post utility to post the LINE_ITEM database against the INVENTORY
  227. database and specifically instruct Alpha FOUR to subtract the QTY
  228. field in the LINE_ITEM database from the IN_STOCK field in the
  229. INVENTORY database. Alpha FOUR should then look for a matching
  230. PART_NO and when it finds it, subtract the quantity sold from the
  231. quantity in stock. 
  232.  
  233. NOTE: To prevent a line item from being applied to the quantity in
  234. stock every time you post you will probably want to add a field
  235. (POSTED) to the LINE_ITEM database. Perform a Global Update on this
  236. field to place a "*" each time this post is performed. Each time you
  237. run the post use a filter: ISBLANK(POSTED). This prevents already
  238. posted line items from being applied against the inventory again.
  239.  
  240. To automate this, you can create a script or application that first
  241. performs the post and then performs a Global Update to update the
  242. POSTED field.
  243.  
  244.  
  245. The suggestions contained here are only that, suggestions. You will
  246. no doubt want to enhance these basic setups to meet your own needs.
  247. We hope that you have found the information contained here to be
  248. useful.
  249.